import request from '@/utils/request'

// 目录列表
export function getDirectoryListApi(params) {
  return request({
    url: 'http://hmmm-api.itheima.net/directorys',
    method: 'get',
    params
  })
}
// 删除
export function delDirectoryApi(id) {
  return request({
    url: `http://hmmm-api.itheima.net/directorys/${id}`,
    method: 'delete'
  })
}
// 目录状态
export function getStateApi(id, state) {
  return request({
    url: `http://hmmm-api.itheima.net/directorys/${id}/${state}`,
    method: 'post'
  })
}
// 目录详情
export function getDirectoryApi(id) {
  return request({
    url: `http://hmmm-api.itheima.net/directorys/${id}`,
    method: 'get'
  })
}

// 目录修改
export function editDirectoryApi(data) {
  return request({
    url: `http://hmmm-api.itheima.net/directorys/${data.id}`,
    method: 'put',
    data
  })
}
// 目录添加
export function addDirectoryApi(data) {
  return request({
    url: `http://hmmm-api.itheima.net/directorys`,
    method: 'post',
    data
  })
}
